package com.example.netty.netty.handler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

public class MyClientInnitialzer  extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {

        socketChannel.pipeline()
                //入站，顺序从上到下，只调用ChannelInboundHandler
                .addLast(new MyByteToLongDecoder())
//                .addLast(new MyByteToLongDecoder2())
                //出站，顺序从下到上，只调用ChannelOutboundHandler
                .addLast(new MyLongToByteEncoder())
                //自定义，继承ChannelInboundHandler，但是也可以发起出站消息
                .addLast(new MyClientHandler());

    }
}
